#ifndef GAMETD_BULLET_H
#define GAMETD_BULLET_H

#include "Vector2.h"
#include "Enemy.h"
#include "Animation.h"

class Bullet {
public:
    Bullet() = default;
    ~Bullet() = default;

    void SetVelocity(const Vector2 &val);
    void SetPosition(const Vector2 &val);
    void SetDamage(double damage);
    const Vector2 &GetSize() const;
    const Vector2 &GetPosition() const;
    double GetDamage() const;
    double GetDamageRange() const;
    void DisableCollide();
    bool CanCollide() const;
    void MakeInvalid();
    bool CanRemove() const;
    virtual void OnUpdate(double delta);
    virtual void OnRender(SDL_Renderer *renderer);
    virtual void OnCollide(Enemy *enemy);

protected:
    Vector2 size;
    Vector2 velocity;
    Vector2 position;

    Animation animation;
    bool canRotated = false; // 是否可以旋转

    double damage = 0; // 伤害
    double damageRange = -1; // 伤害范围,可以爆炸的

private:
    bool isValid = true;
    bool isCollisional = true; // 是否可以发生碰撞
    double angleAnimRotated = 0; // 子弹旋转角度
};

#endif // GAMETD_BULLET_H
